package toolsUseCourse;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

public class test {
    public static void main(String[] args) {
        URL url = null;
        URLConnection uc = null;
        InputStream inputStream = null;
        FileOutputStream out = null;

        try {
            url = new URL("http://dpurl.cn/n/1lqcX");

            uc = url.openConnection();
            uc.setRequestProperty("User-Agent","Mozilla/5.0(Wi)");
            inputStream = uc.getInputStream();

            File file;
            out  = new FileOutputStream("D:\\file\\ebook\\2018年美团技术干货（合集）.PDF");
            int j = 0;
            while ((j = inputStream.read()) != -1){
                out.write(j);
            }
            inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
